fix(backup): file-coordinated container I/O so iCloud actually uploads (build 12) - #22
Merged
Merged
Conversation
…s (build 12) Live observation from a second device on the same Apple ID proved the container's directory skeleton synced but no file ever reached the server - a 30-minute watch during a forced full re-mirror recorded zero arrivals. Uncoordinated writes (atomic rename-into-place in particular) are not reliably seen by the iCloud sync daemon. - All container mutations now run under NSFileCoordinator (.forReplacing / .forDeleting); the catalog/manifest write is a coordinated in-place data write instead of String.write(atomically:), whose rename is what left files invisible to the daemon. - New uploadStatus (NSMetadataUbiquitousItemIsUploadedKey) reports how much of the backup Apple's servers actually hold; the support-sheet status line now says 'Backing up - N files still uploading to iCloud' (localized in all 13 languages) until everything is durable, instead of implying safety while data sits only in the local replica. Simulator smoke: the coordinated paths produce a byte-identical mirror. Real-iCloud validation: live Mac-side container watch during a device re-mirror, which previously recorded zero uploads. Claude-Session: https://claude.ai/code/session_01Y9r9L2vDPQwyEEV61qWyfp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Live evidence (Mac on the same Apple ID watching the real container): directories synced, but a 30-minute watch during a forced device re-mirror recorded zero file uploads — uncoordinated writes, especially atomic rename-into-place, are invisible to the iCloud daemon. All container mutations are now NSFileCoordinator-coordinated, and a new uploadStatus probe (NSMetadataUbiquitousItemIsUploadedKey) drives an honest status line ('Backing up — N files still uploading to iCloud', localized ×13) so 'backed up' is only claimed when Apple's servers hold the data.
48/48 tests, typecheck, sim smoke (coordinated mirror byte-identical). Real upload validated post-merge via the live Mac-container watch during a TestFlight re-mirror.
https://claude.ai/code/session_01Y9r9L2vDPQwyEEV61qWyfp